package com.dingwei.superiordiary.adapter.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.dingwei.superiordiary.R;
import com.dingwei.superiordiary.bean.IconPowerMenuItem;
import com.skydoves.powermenu.MenuBaseAdapter;

public class IconMenuAdapter extends MenuBaseAdapter<IconPowerMenuItem> {
 
    @Override
    public View getView(int index, View view, ViewGroup viewGroup) {
        final Context context = viewGroup.getContext();
 
        if(view == null) {
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            view = inflater.inflate(R.layout.item_icon_menu, viewGroup, false);
        }
 
        IconPowerMenuItem item = (IconPowerMenuItem) getItem(index);
        final ImageView icon = (ImageView) view.findViewById(R.id.item_icon);
        icon.setImageDrawable(item.getIcon());
        return view;
    }
}